<template>
  <div class="workflow-page">
    <!-- 科技风背景动画 -->
    <div class="tech-background">
      <div class="flow-nodes">
        <div v-for="i in 12" :key="i" class="flow-node" :style="getNodeStyle(i)"></div>
      </div>
      <div class="flow-lines">
        <div v-for="i in 8" :key="i" class="flow-line" :style="getLineStyle(i)"></div>
      </div>
      <div class="grid-pattern"></div>
    </div>

    <div class="ios-container">
      <div class="ios-navbar">
        <IOSBackButton @click="router.back()" />
      </div>
      <div class="content-wrapper">
        <h1 class="page-title">⚡ 工作流管理</h1>
        <p class="page-description">可视化工作流设计器，拖拽式构建复杂业务流程</p>
        <div class="feature-grid">
          <div class="feature-card">
            <div class="feature-icon">🔄</div>
            <h3>流程设计</h3>
            <p>拖拽式流程构建</p>
          </div>
          <div class="feature-card">
            <div class="feature-icon">⚙️</div>
            <h3>自动化执行</h3>
            <p>智能任务调度</p>
          </div>
          <div class="feature-card">
            <div class="feature-icon">📊</div>
            <h3>实时监控</h3>
            <p>流程状态追踪</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import IOSBackButton from '~/components/IOSBackButton.vue'
const router = useRouter()

const getNodeStyle = (index) => {
  const positions = [
    { top: '15%', left: '10%' },
    { top: '25%', left: '30%' },
    { top: '35%', left: '60%' },
    { top: '45%', left: '80%' },
    { top: '55%', left: '20%' },
    { top: '65%', left: '50%' },
    { top: '75%', left: '70%' },
    { top: '85%', left: '15%' },
    { top: '10%', left: '85%' },
    { top: '40%', left: '5%' },
    { top: '70%', left: '90%' },
    { top: '90%', left: '45%' }
  ]
  const pos = positions[index - 1] || { top: '50%', left: '50%' }
  return {
    ...pos,
    animationDelay: `${(index - 1) * 0.5}s`
  }
}

const getLineStyle = (index) => {
  const lines = [
    { top: '20%', left: '15%', width: '200px', transform: 'rotate(25deg)' },
    { top: '30%', left: '35%', width: '250px', transform: 'rotate(-15deg)' },
    { top: '50%', left: '25%', width: '300px', transform: 'rotate(35deg)' },
    { top: '70%', left: '55%', width: '180px', transform: 'rotate(-25deg)' },
    { top: '40%', left: '65%', width: '220px', transform: 'rotate(45deg)' },
    { top: '80%', left: '20%', width: '280px', transform: 'rotate(15deg)' },
    { top: '15%', left: '70%', width: '160px', transform: 'rotate(-35deg)' },
    { top: '60%', left: '75%', width: '200px', transform: 'rotate(55deg)' }
  ]
  const line = lines[index - 1] || { top: '50%', left: '50%', width: '200px', transform: 'rotate(0deg)' }
  return {
    ...line,
    animationDelay: `${(index - 1) * 0.3}s`
  }
}
</script>

<style scoped>
.workflow-page {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.tech-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: -1;
}

.grid-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
}

.flow-nodes {
  position: absolute;
  width: 100%;
  height: 100%;
}

.flow-node {
  position: absolute;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
  animation: pulse 3s ease-in-out infinite;
}

.flow-lines {
  position: absolute;
  width: 100%;
  height: 100%;
}

.flow-line {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.6) 20%, 
    rgba(255, 255, 255, 0.8) 50%, 
    rgba(255, 255, 255, 0.6) 80%, 
    transparent 100%);
  animation: lineFlow 4s ease-in-out infinite;
}

.ios-container {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.ios-navbar {
  padding: 10px 0;
  margin-bottom: 20px;
}

.content-wrapper {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.page-title {
  font-size: 3rem;
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.page-description {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  margin-bottom: 40px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 30px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.feature-card:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-5px);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.feature-card h3 {
  color: white;
  font-size: 1.3rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.feature-card p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

@keyframes pulse {
  0%, 100% { 
    transform: scale(1);
    opacity: 0.6;
  }
  50% { 
    transform: scale(1.5);
    opacity: 1;
  }
}

@keyframes lineFlow {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

@media (max-width: 768px) {
  .content-wrapper {
    padding: 20px;
  }
  
  .page-title {
    font-size: 2rem;
  }
  
  .feature-grid {
    grid-template-columns: 1fr;
  }
}
</style>
